package com.baizhi.controller;

import com.baizhi.service.BzMenuService;
import com.baizhi.vo.MenuVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author yu
 */
@RestController
public class BzMenuController {
    @Autowired
    private BzMenuService bzMenuService;

    @PreAuthorize("hasAnyRole('vip')")
    @GetMapping("/bzMenu")
    public Map showAllMenu(){
        HashMap<String, Object> map = new HashMap<>();
        List<MenuVo> menuVos = bzMenuService.showMenuList();
        map.put("data",menuVos);
        map.put("status","success");
        return map;
    }
}
